import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 查询所有员工 /sysManage/basedata/users/getUserListByRole
export const getDealerUser = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getDealerUser`);
// 维修领料 查询
export const queryMaintainPicking = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/SearchMaintainPicking/queryMaintainPicking`, { params });

// 维修领料编辑 queryPartStock
// export const queryPartStock = ({ partNo, storageCode }) => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/queryPartStock/${partNo}/${storageCode}`);
export const queryPartStock = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/queryPartStock`, { params });

// 修理项目
export const searchTtRoLabour = ({ roNo }) => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/searchTtRoLabour/${roNo}`);

// 新增
export const queryPartInfo = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/queryPartInfo`, { params });

// 保存
export const btnSave = params => axios.post(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/btnSave`, params);

// 备件模块查询工单
export const queryWorkOrder = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/searchRepairOrder`, { params });

// 出库 /account
export const account = params => axios.post(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/account`, params);

// 退前料查工单 /basedata/ttRepairOrder/queryReturnFromOrder
export const queryReturnFromOrder = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/queryReturnFromOrder`, { params });

// 新增
// export const queryTax = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/parms`, { params });
export const queryTax = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/params/getParaValue?module=SPA&para=BJCGSL`);

// 提取预估备件
export const queryEstPart = params => axios.get(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials`, { params });

// 提取预估备件保存
export const saveEstPart = params => axios.post(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials`, params);

// ETKA材料单查询
export const queryEtkaInfos = params => axios.get(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/queryEtkaInfos`, { params });

// ETKA材料单查询 - 打印
export const queryEtkaParts = params => axios.get(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/queryEtkaParts`, { params });

// 查询所有员工  服务顾问
export const getAllUser = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getDealerUser`);

// 替换件
export const queryEtkaPartStock = params => axios.get(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/queryEtkaPartStock`, { params });

// 详情-新增
export const queryPartInfos = params => axios.get(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/queryPartInfos`, { params });

// 详情-删除备件
export const delEstPart = params => axios.delete(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials`, { params });

// 详情-保存备件
export const addEtkaPart = params => axios.post(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/addEtkaPart`, params);

// 详情-加入领料单
export const addEtkaPartToRo = params => axios.post(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/addEtkaPartToRo`, params);

// 详情-审核
export const exaEstPart = params => axios.put(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials`, params);

// 详情-同步参考零售价
export const syncPartPrice = params => axios.put(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/syncPartPrice`, params);

// 新能源备件-默认查询
export const queryPartNewEnergy = (id, params) => axios.get(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/queryPartNewEnergy/${id}`, { params });

// 新能源备件-保存
export const addPartNewEnergy = params => axios.post(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/addPartNewEnergy`, params);
// 打印数据获取one
export const printDataOne = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/queryPrintRepairOrderData`, { params });

// ETKA-打印验证
export const checkEtkaPart = params => axios.get(`${SERVER.DMSCLOUD_PART}/partInfo/partMeterials/checkEtkaPart`, { params });

// 获取所有车型
export const getAllModel = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/Allmodel`, { params });

// 收费区分 - 下拉框
export const getSfqfSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/chargeDifferentiationList`, {
    params
  });

// 发料时必须指定领料人
export const findAllRepair = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/BasicParametersAfterSales`, { params });

// 前台领料
export const saveRepairFront = params => axios.post(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/saveRepairFront`, params);

// 根据工单号以及发料单号查询打印数据
export const queryPrintDataByRoNoOutStockNo = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/searchRoRepairPart`, { params });

// 根据工单号获取最后一次出库的出库单号
export const queryLastOutNoByRoNo = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/searchRoRepairPart/${params}`);

// 删除行数据
export const delPartInfo = params => axios.delete(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/delPartInfo/${params}`);

// 前台领料新增 查询
export const queryPartFrontInfo = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/queryPartFrontInfo`, { params });

// 前台领料删除
export const delFrontPartInfo = (dels, roNo) => axios.delete(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/delFrontPartInfo/${dels}/${roNo}`);

//退料
export const exitPart = params => axios.post(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/exitPart`, params);

// 打印数据获取退料
export const getExitPart = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/ttRepairOrder/getExitPart`, { params });
